//package com.qike.duola.utils;
//
//import com.dingtalk.api.DefaultDingTalkClient;
//import com.dingtalk.api.request.OapiGettokenRequest;
//import com.dingtalk.api.response.OapiGettokenResponse;
//import com.qike.duola.config.Constant;
//import com.taobao.api.ApiException;
//import org.springframework.beans.factory.annotation.Value;
//import org.springframework.stereotype.Component;
//
///**
// * @Author: Eric.zhou
// * @Date: 2019/7/23 10:53
// */
//@Component
//public final class DingDingTokenUtil {
//
//
//    private static String appKey;
//    @Value("${dingding.Appkey}")
//    public  void setAppKey(String appKey) {
//        DingDingTokenUtil.appKey = appKey;
//    }
//    private static String appSecret;
//    @Value("${dingding.Appsecret}")
//    public  void setAppSecret(String appSecret) {
//        DingDingTokenUtil.appSecret = appSecret;
//    }
//
//    public static  String getToken()  {
//            DefaultDingTalkClient client = new DefaultDingTalkClient(Constant.TOKEN_URL);
//            OapiGettokenRequest request = new OapiGettokenRequest();
//            request.setAppkey(appKey);
//            request.setAppsecret(appSecret);
//            request.setHttpMethod("GET");
//        OapiGettokenResponse response = null;
//        try {
//            response = client.execute(request);
//        } catch (ApiException e) {
//            e.printStackTrace();
//        }
//        String accessToken = response.getAccessToken();
//            return accessToken;
//        }
//    }
//
